1. Field of the Invention
This invention relates generally to electronic networks, and more particularly to a system and method for multi-level context switching in an electronic network.
2. Description of the Background Art
Utilizing an effective method for managing communications between electronic devices within an electronic network is a significant consideration of designers, manufacturers, and users of electronic devices. An electronic device in an electronic network may advantageously communicate with other electronic devices in the network to share data and substantially increase the resources available to each device in the network. For example, an electronic network may be installed in a user""s home to enable flexible and beneficial sharing of resources between various consumer electronic devices, such as personal computers, digital video disc (DVD) devices, digital set-top boxes for digital broadcasting, television sets, and audio playback systems.
An electronic device in an electronic network may alternately receive or transmit data across the network. Therefore, an electronic device may be required to function both as a transmitter and as a receiver of data. In such a case, the electronic device may be required to switch between a transmit mode and a receive mode, that is, to switch contexts. Context switching is especially important in electronic networks where each device in the network has a combined input/output interface with the network. Since data may be transmitted and received via the same interface, such a device may not transmit data and receive data at the same time. Therefore, a device may need to switch contexts to effectively communicate with other devices in the network.
In some types of electronic networks, electronic devices may be xe2x80x9cdaisy-chainedxe2x80x9d so that devices are directly connected to one another in a tree-like structure instead of being connected to a common network bus structure. In such a network, data being delivered via the bus may pass through various intermediary devices before arriving at the destination device. An intermediary device, in a receive context, may receive data and then switch to a transmit context to transmit the data to another device. Alternately, an intermediary device may transmit data to a destination device in a transmit context, and then switch to a receive context to function as a destination device for different data.
In some electronic networks, when a device is currently preparing to transmit data on the bus, the device typically is not able to receive data at the same time. However, if the device does not receive the data intended for it, that data may be lost. Loss of data may especially be a problem in a situation where the source of the data is a broadcast signal that cannot be repeated if the data is not received. Further, when a device is currently processing received data, the device typically is not able to receive other data, which may also result in loss of data. Therefore, efficient and flexible context switching is needed to prevent loss of data being sent across the network.
Context switching in an electronic network should be as efficient and flexible as possible to maintain effective communications across the network. Therefore, managing communications between electronic devices in an electronic network remains a significant consideration for designers, manufacturers, and users of electronic devices.
In accordance with the present invention, a system and method are disclosed for implementing multi-level context switching in an electronic network. In one embodiment, the invention includes a control state machine configured to implement a data priority scheme, a processor configured to process data from the electronic network in accordance with the data priority scheme and context information from the electronic network, and a return address generator. The return address generator is configured to hold and release return addresses for interrupted instruction modules in accordance with the data priority scheme and the context information.
The invention also includes receive registers that store data received from the electronic network. The control state machine selects data from one of the receive registers for processing according to the data priority scheme and the context information from the electronic network.
The invention also includes a memory coupled to the control state machine, which stores instruction modules for execution by the processor. Each of the instruction modules corresponds to a context. The memory preferably stores a cycle start instruction module, a transmit instruction module, and a receive instruction module for each data channel supported by the electronic network. The control state machine selects one of the instruction modules for execution by the processor in response to context information contained in data packet headers received from the electronic network and in accordance with the data priority scheme.
The control state machine includes a switch address generator and a program counter select. The switch address generator outputs a switch address, which is an address for a first instruction for a selected-context instruction module. The return address generator holds and releases the return addresses, which are addresses of next consecutive instructions, when an instruction module is interrupted for a context switch. The program counter select outputs a switch address, a return address, or a next consecutive address to select the appropriate instruction in the memory for execution by the processor.
Execution of an instruction module may be interrupted when a context switch occurs. The return address generator holds and releases return addresses so that interrupted instruction modules may be resumed at the point where each interruption occurred. A transmit operation may be interrupted for a receive operation or a cycle start operation. A receive operation may be interrupted by another receive operation if the incoming data has a higher priority according to the data priority scheme. The data priority scheme includes priority criteria determined by processing requirements of received data. The priority criteria may include signal speed, length, and decryption requirements of the received data. The present invention thus efficiently and effectively implements a system and method for multi-level context switching in an electronic network.